#include<stdio.h>
#include<thread>
#include"../xxxpcsc/log.h"
#include"../xxxpcsc/util.h"
int main(){
	xxXPCSC::Logger::ptr logger(new xxXPCSC::Logger);
    logger->addAppender(xxXPCSC::LogAppender::ptr(new xxXPCSC::StdoutLogAppender));

    xxXPCSC::FileLogAppender::ptr file_appender(new xxXPCSC::FileLogAppender("../logs/log.txt"));

    //%T%p
    xxXPCSC::LogFormatter::ptr fmt(new xxXPCSC::LogFormatter("%d%T%p%T%m%n"));

    file_appender->setFormatter(fmt);
    //file_appender->setLevel(xxXPCSC::LogLevel::ERROR);
    logger->addAppender(file_appender);
    //xxXPCSC::LogEvent::ptr event(new xxXPCSC::LogEvent(__FILE__,__LINE__,0,xxXPCSC::GetThreadId(),xxXPCSC::GetFiberId(),time(0)));
    //logger->log(xxXPCSC::LogLevel::DEBUG,event);
    XXXPCSC_LOG_INFO(logger) <<"test INFO";
    XXXPCSC_LOG_ERROR(logger)<<"test ERROR";
    XXXPCSC_LOG_FMT_ERROR(logger,"test macro fmt error %s","aa");

    auto L = xxXPCSC::LoggerMgr::GetInstance()->getLogger("xx");
    XXXPCSC_LOG_INFO(L)<<"xxx";
	return 0;
}
